package com.cicadamob.contact.api.service;


public class UpdateState
{
	public static final int MOBILE_NOT_EXIST = 1; //手机号码为空
	public static final int IMSI_NOT_EXIST = 2; //未检测到手机卡
	public static final int JSON_DATA_EXCEPTION = 3; //数据解析异常
	public static final int UNPERMISSION_EXCEPTION = 4; //认证失败
	public static final int NET_EXCEPTION = 5; //网络连接失败异常
	public static final int SERVER_EXCEPTION = 6; //网络连接失败异常
	public static final int TREE_CONFLICT = 7; //服务端没有新数据可更新
	public static final int CONTACT_CONFLICT = 8; //服务端没有新数据可更新
	public static final int CONTACT_DATAERROR= 9; //数据错误
	public final static int parametererror = 802;	 /**参数不正确*/
	public final static int usernotexist = 803;     /**用户不存在*/
	public final static int filenotfound = 808;     /**初始化数据文件不存在*/
	
	//801：token为空；802:令牌过期；803：用户不存在；804:管控平台返回错误的请求参数；805：管控平台返回其他错误码
	public static final int TOKEN_NULL = 801;
	public static final int TOKEN_OUT_DATE = 802;
	public static final int USER_NULL = 803;
	public static final int TOKEN_REQUEST_ERROR = 804;
	public static final int OTHER_ERROR = 805;
	
	public int state; //当前状态
	
	private String exceptionMessage;
	
	public String getExceptionMessage() {
		return exceptionMessage;
	}

	public void setExceptionMessage(String exceptionMessage) {
		this.exceptionMessage = exceptionMessage;
	}

	public String getTip()
	{
		if(state == MOBILE_NOT_EXIST)
		{
			return "更新失败，手机号不能为空";
		}
		else if(state == IMSI_NOT_EXIST)
		{
			return "更新失败，未检测到手机卡";
		}
		else if(state == JSON_DATA_EXCEPTION)
		{
			return "通讯录解析异常，系统自动反馈，请稍候再更新";
		}
		else if(state == UNPERMISSION_EXCEPTION)
		{
			return "没有权限";
		}
		else if(state == NET_EXCEPTION)
		{
			return "更新失败，网络连接失败，请检查网络";
		}
		else if(state == SERVER_EXCEPTION)
		{
			return "更新失败，连接服务器失败";
		}
		else if(state == TREE_CONFLICT)
		{
			return "已经是最新的单位组织结构！";
		}
		else if(state == CONTACT_CONFLICT)
		{
			return "已经是最新的单位通讯录！";
		}
		else if(state == CONTACT_DATAERROR)
			return "更新失败，更新后的数据错误！";
//		else if(state == parametererror)
//			return "下载客户通讯录数据失败,参数错误(错误代码:"+ parametererror +")";
//		else if(state == usernotexist)
//			return "下载客户通讯录数据失败,用户不存在(错误代码:"+usernotexist+")";
		else if(state == filenotfound)
			return "下载客户通讯录数据失败,数据文件不存在(错误代码:"+filenotfound+")"; 
		else  if(state == TOKEN_NULL) 
			return "token为空"; 
		else if(state == TOKEN_OUT_DATE) 
			return "令牌过期"; 
		else if(state == USER_NULL) 
			return "非集团成员，请联系集团管理员"; 
		else if(state == TOKEN_REQUEST_ERROR) 
			return "管控平台返回错误的请求参数"; 
		else if(state == OTHER_ERROR) 
			return "管控平台返回其他错误码"; 
		return null;
	}
	
}
